Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Summary
The problem is that$D_2$ and $D_3$ each carry a large constant of their own and those were not being removed.
2. Where the constants lives
2.1 The$D_2$ term
From
calculateD2/calculateP2(gm_to_dirac_short.tpp):with the width-dependent prefactor and exponent
The position dependence enters only through$z_i(b)$ . Now observe the limit: as $b\to\infty$ the denominators $\sigma_k^2+2b^2$ blow up, so $z_i(b)\to 0$ and $e^{z_i(b)}\to 1$ for every point, regardless of where it is. Meanwhile $\rho(b)\to b$ , which grows without bound.
So the integrand tends to$b\sum_i w_i = bW$ : a linearly growing quantity carrying zero information about the configuration. Integrating it over $[0,b_{\max}]$ contributes $\approx -b_{\max}^2 W$ of pure dead weight.
Making the split explicit with the exact identity$e^{z} = 1 + expm1(z)$ (where $expm1(z) = e^{z} - 1$ ):
The constant piece is already computable from existing code. Writing$\rho$ in terms of
calculateP1:So the$D_2$ constant is exactly $-2W\,2^{N/2}D_1$ , where $=2^{N/2}$ are already members of
D1andtwoPiNHalfGMToDiracBaseOptimizationParams.2.2 The$D_3$ term
From
calculateD3, the pairwise self term isThe leading$4b_{\max}^2$ has no $d_{ij}$ in it at all. Summed over every ordered pair:
2.3 The total offset, in closed form
The optimizer now optimises$D_2 + D_3$ without the constants. The public distance function still returns the old value.
3. Results
3.1 Standard Normal Samples
3.2 Correlated Samples